﻿namespace NetFx.SMIL.Definitions
{
  using System;
  using System.Text;
  using System.Collections;

  using System.Reflection;
  using System.Reflection.Emit;
  using System.Runtime.InteropServices;

  using System.Diagnostics;
  using System.Diagnostics.CodeAnalysis;
  using System.Diagnostics.SymbolStore;
  using System.Security;
  using System.Security.Permissions;

  using NetFx.MSIL;
  using NetFx.MSIL.Headers;

  public class PropertyDefinition : ComplexDefinition
  {
    #region Statics
    public static PropertyDefinition of(string name)
    {
      return new PropertyDefinition(name);
    }
    #endregion
    #region Fields
    protected string returnType;
    protected string getter;
    protected string setter;
    #endregion
    #region Properties
    public virtual PropertyHeader InstanceHeader
    {
      get
      {
        return this.header as PropertyHeader;
      }
    }
    public virtual string ReturnType
    {
      get
      {
        return this.returnType;
      }
      set
      {
        this.returnType = value;
      }
    }
    public virtual string Getter
    {
      get
      {
        return this.getter;
      }
      set
      {
        this.getter = value; 
      }
    }
    public virtual string Setter
    {
      get
      {
        return this.setter;
      }
      set
      {
        this.setter = value;
      }

    }
    public virtual IList ParameterDefinitions
    {
      get
      {
        return this.Definitions;
      }
    }
    public virtual PropertyAttributes Attributes
    {
      get
      {
        return this.InstanceHeader.Attributes;
      }
      set
      {
        this.InstanceHeader.Attributes = value;
      }
    }
    public virtual object DefaultValue
    {
      get
      {
        return this.InstanceHeader.DefaultValue;
      }
      set
      {
        this.InstanceHeader.DefaultValue = value;
      }
    }
    #endregion
    #region Constructors
    public PropertyDefinition(string name)
      : this(PropertyHeader.of(name))
    {

    }
    public PropertyDefinition(PropertyHeader header)
      : base(header)
    {

    }
    #endregion
    #region Methods
    public virtual ParameterDefinition DefineParameter(string name)
    {
      return this.AddDefinition(ComplexDefinition.CreateParameterDefinition(name))
        as ParameterDefinition;
    }


    protected override void Resolve(ComplexDefinition container)
    {

    }
    #endregion
  }

}